local M = _G.ClientOHOH.class.new(script,_G.ClientOHOH.files.Client_PlayerComponent(),script.Parent.Name)
local ConnectClass=_G.CommonOHOH.load.Connect();

function M.new(self,...)
    return M(self,...)
end

function M.ctor(self,parent)
    M.super.ctor(self,parent)
    self.DataStore = self.parent:GetComponent(_G.ClientOHOH.load.Client_PlayerDataComponent())
    self.player = parent

    self.hp=self.player.attribute.Hp or 0
    self.maxHp=self.player.attribute.MaxHp or 0
    self.attack=self.player.attribute.Attack or 0
    self.propulsion=self.player.attribute.Propulsion or 0
    self.UpdateEvent=ConnectClass.new()


    self.player:AttributeValueChanged("Hp",function()
        self.hp=self.player.attribute.Hp
        self.UpdateEvent:Action()
    end)

    self.player:AttributeValueChanged("MaxHp",function()
        self.maxHp=self.player.attribute.MaxHp
        self.UpdateEvent:Action()
    end)

    self.player:AttributeValueChanged("Propulsion",function()
        self.propulsion=self.player.attribute.Propulsion
        self.UpdateEvent:Action()
    end)
    self.player:AttributeValueChanged("Attack",function()
        self.attack=self.player.attribute.Attack
        self.UpdateEvent:Action()
    end)


end

--获取最大hp
function M.GetMaxHp(self)
    return self.hp
end

--获取当前hp
function M.GetHp(self)
    return  self.maxHp
end

--获取攻击力
function M.GetAttack(self)
    return self.attack
end

--获取推进力
function M.GetPropulsion(self)
    return self.propulsion
end


function M.dtor(self)
    M.super.dtor(self)
end


return M 